<template>
  <div>
    Child: {{money}}
    <button @click="handleClick">update money</button>
  </div>
</template>

<script>
import { inject } from 'vue';

export default {
  setup () {
    // !#2 通过 inject 注入数据
    const money = inject('money')
    const changeMoney = inject('changeMoney')

    const handleClick = () => {
      changeMoney(3)
    }
    return {
      money,
      handleClick
    }
  }
}
</script>

<style lang="scss" scoped>

</style>